package Test;

public class Body {
    private String owner;
    private double weight;
    private boolean health;
    private Organ heart;

    Heart heart1 = new Heart();

    private class Heart extends Organ {
        //心率，颜色，大小
        private int heartBeat;
        private String color;

        double size = weight*0.005;
        @Override
        public void doWork() {
            System.out.println("为血液流动提供动力，把血液运行至"+owner+"的身体各个部分");
            System.out.println("心率："+heartBeat+"次/分，大小："+size+"克，颜色："+color);
        }

        public int getHeartBeat() {
            return heartBeat;
        }

        public void setHeartBeat(int heartBeat) {
            this.heartBeat = heartBeat;
        }

        public String getColor() {
            return color;
        }

        public void setColor(String color) {
            this.color = color;
        }

        public double getSize() {
            return size;
        }

        public void setSize(double size) {
            this.size = size;
        }

        public Heart() {
        }

        public Heart(int heartBeat, String color, double size) {
            this.heartBeat = heartBeat;
            this.color = color;
            this.size = size;
        }
    }

    @Override
    public String toString() {
        return "Body{" +
                "owner='" + owner + '\'' +
                ", weight=" + weight +
                ", health=" + health +
                ", heart=" + heart +
                '}';
    }

    public Body() {
    }

    public Body(String owner, double weight, boolean health, Organ heart) {
        this.owner = owner;
        this.weight = weight;
        this.health = health;
        this.heart = heart;
    }

    public String getOwner() {
        return owner;
    }

    public void setOwner(String owner) {
        this.owner = owner;
    }

    public double getWeight() {
        return weight;
    }

    public void setWeight(double weight) {
        this.weight = weight;
    }

    public boolean isHealth() {
        return health;
    }

    public void setHealth(boolean health) {
        this.health = health;
    }

    public Organ getHeart() {
        return heart;
    }

    public void setHeart(Organ heart) {
        this.heart = heart;
    }
}
